#define DEBUG
#include <cstdio>

using namespace std;

const int maxr=300, mods=1000000007;

long long c[2*maxr+1][2*maxr+1]; 

void initC(int n) {
  c[0][0] =1 ;
  for (int i=1; i<=n; i++) {
    c[i][0] = 1;
    for (int j=1; j<=i; j++) {
      c[i][j] = (c[i-1][j]+c[i-1][j-1])%mods;
    }
  }
}

long long solve(int x, int y, int r, int s, int now, int n, int map[][maxr+1]) {
  now *= map[x][y];
  if (now>=n) {
    return c[r-x+s-y][r-x];
  } else {
    long long ret=0;
    if (x+1<=r) {
      ret = (ret+solve(x+1, y, r, s, now, n, map))%mods;
    }
    if (y+1<=s) {
      ret = (ret+solve(x, y+1, r, s, now, n, map))%mods;
    }
    return ret;
  }
}

int main() {
  freopen("mobitel.in", "r", stdin);
  freopen("mobitel.out", "w", stdout);

  static int map[maxr+1][maxr+1];
  int r, s, n;
  scanf("%d %d %d", &r, &s, &n);

  for (int i=1; i<=r; i++) {
    for (int j=1; j<=s; j++) {
      scanf("%d", &map[i][j]);
    }
  }

  initC(2*maxr);

  printf("%lld", solve(1, 1, r, s, 1, n, map));

  fclose(stdin);
  fclose(stdout);
  return 0;
}
